#include <iostream>
#include <cstdio>

using namespace std;

int main(){
    int n, l, p, maxt = -1, mint = -1;
    cin >> l >> n;
    if(n == 0){
        cout << 0 << " " << 0 < <endl;
        return 0;
    }
    for(int i = 1; i <= n; i++){
        scanf("%d", &p);
        maxt = max(maxt, max(l-p+1, p));
        mint = max(mint, min(l-p+1, p));
    }
    printf("%d %d", mint, maxt);
    return 0;
}